import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '@/views/home.vue'
import Layout from '@/views/layout.vue'
import Find from '@/views/find.vue'
import News from '@/views/news.vue'
import User from '@/views/user.vue'
import City from '@/views/city.vue'
import Map from '@/views/map.vue'
import Login from '@/views/login.vue'
import Register from '@/views/register.vue'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: Layout,
    redirect: '/home',
    children: [
      { path: 'home', component: Home },
      { path: 'find', component: Find },
      { path: 'news', component: News },
      { path: 'user', component: User },
      { path: '/map', component: Map }
    ]
  },
  { path: '/city', component: City },
  { path: '/login', component: Login },
  { path: '/register', component: Register }
]

const router = new VueRouter({
  routes
})

export default router
